package com.sec.android.app.myfiles.shadow.custom;

import com.sec.android.app.myfiles.log.SamsungAnalyticsLog;

import junit.framework.Assert;

import org.robolectric.annotation.Implements;

/**
 * Created by yunju.cha on 2017-02-06.
 */
@Implements(SamsungAnalyticsLog.class)
public class ShadowSamsungAnalyticsLog {
    static StringBuilder mLogMsgBuilder;
    public static boolean mEnableVerifyLog = false;

    public static void setEnableVerifyLog(boolean enable) {
        mEnableVerifyLog = enable;
        mLogMsgBuilder = null;
        if (mEnableVerifyLog) {
            mLogMsgBuilder = new StringBuilder();
        }
    }

    public static void verifyLog(String msg) {
        boolean bRet = false;

        if (mLogMsgBuilder != null) {
            int index = mLogMsgBuilder.indexOf(msg, 0);
            bRet = index >= 0;
        }

        Assert.assertTrue(msg, bRet);
    }

}
